﻿// Insperation from http://msdn.microsoft.com/en-us/library/dd254918(v=xnagamestudio.31).aspx 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace Santa_sAdventure.Model
{
    class Animation
    {
        private Texture2D m_animationTexture;
        private int m_animationDurationSec;

        public Animation(Texture2D a_animationTexture, int a_animationDurationSec, bool a_isLooping, int a_numberOfFrames)
        {
            m_animationTexture = a_animationTexture;
            m_animationDurationSec = a_animationDurationSec;
            IsLooping = a_isLooping;
            NumberOfFrames = a_numberOfFrames;
            FrameTime = (float)a_animationDurationSec / (float)a_numberOfFrames;
        }

        // If it should be looped
        internal bool IsLooping { get; set; }

        // Number of frames in the texture
        internal int NumberOfFrames { get; set; }

        // How long time should the animation take
        internal int Duration { get { return m_animationDurationSec; } }

        // How much time a single frame takes
        internal float FrameTime { get; set; }

        // Animation texture
        internal Texture2D Texture { get { return m_animationTexture; } }

        /// Gets the width of a frame in the animation.
        public int FrameWidth
        {
            // Assume square frames.
            get { return Texture.Height; }
        }

        /// Gets the height of a frame in the animation.
        public int FrameHeight
        {
            get { return Texture.Height; }
        }
    }
}
